Skip to content

ArrayString: Reducing reliance on unsafe blocks + adding some safety comments#288

Open
anforowicz wants to merge 5 commits intobluss:masterfrom
anforowicz:removing-unsafe
Open

ArrayString: Reducing reliance on unsafe blocks + adding some safety comments#288
anforowicz wants to merge 5 commits intobluss:masterfrom
anforowicz:removing-unsafe

Conversation

@anforowicz
Copy link

PTAL? Please see the individual commit descriptions for more details.

Before the changes in `fn new`, the type of `MaybeUninit::uninit()`
would be inferred to be `MaybeUninit<[MaybeUninit<...>; CAP]>` which
seems somewhat unexpected.  This commit rewrites this expression so that
no `unsafe` is needed.

Similarily, before the changes in `fn zero_filled`, the type of
`MaybeUninit::zeroed()` would be inferred to be
`MaybeUninit<[MaybeUninit<...>; CAP]>`.  This commit also rewrites this
expression so that no `unsafe` is needed.
The safe code results in the same, fast assembly code.
The safe code should result in the same, fast assembly code.
This also opportunistically reduces the amount of `unsafe` in
`ArrayString::remove`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant